home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / TSTHFLT2 / CON_FILT.PAS < prev    next >
Pascal/Delphi Source File  |  1996-12-01  |  5KB  |  182 lines

  1. {(s0p16h0s0b4099T}
  2. Program Con_filt;
  3.  
  4. Uses Dos, Strings, TSTHunit;
  5.  
  6. Var
  7.   TstHostIRQVector : Byte;            {IRQ vector to get the info}
  8.                                       {WARNING : This is NOT the IRQ vector for
  9.                                        communication to e.g. TFPCX(286) driver!}
  10.   TstHostActive,                      { True if TstHost is active }
  11.   FullInfo         : Boolean;         { Fullinfo set in config file }
  12.  
  13.  
  14. Procedure ReadCfgFile(FileName : String; Var Full : Boolean);
  15.  
  16. (* Read Cfg file *)
  17.  
  18. Var
  19.   FileInput     : Text;
  20.   Line          : String;
  21.   DirInfo       : SearchRec;
  22.   Code,
  23.   Channel       : Integer;
  24.  
  25. Begin
  26.   Full := False;
  27.   FindFirst(FileName,AnyFile,DirInfo);
  28.   If DosError > 0 then
  29.   Begin
  30.     Exit;
  31.   End;
  32.  
  33.   Assign(FileInput, FileName);
  34.   {$I-}
  35.   Reset(FileInput);
  36.   {SI+}
  37.   If IOResult <> 0 then
  38.   Begin
  39.     Exit;
  40.   End;
  41.  
  42.   Repeat
  43.     Readln(FileInput,Line);
  44.     If (Copy(Line,1,1) <> '#') and
  45.     (Pos('INFO',UpCaseStr(Line)) > 0) and (Pos('FULL',UpCaseStr(Line)) > 0)
  46.      then Full := True;
  47.     Val(Copy(Line,1,1),Channel,Code);
  48.     If (Code = 0) and (Channel >= 1) and (Channel <= 8) then
  49.     Begin
  50.       ChannelData[Channel].ExtraInfo := '(' + Copy(Line,3,8) + ')';
  51.       While Length(ChannelData[Channel].ExtraInfo) < 10 Do
  52.         ChannelData[Channel].ExtraInfo := ChannelData[Channel].ExtraInfo + ' ';
  53.     End;
  54.   Until Eof(FileInput);
  55.   Close(FileInput);
  56. End;
  57.  
  58.  
  59. Function GetConnectChannel : Byte;
  60.  
  61. (* Returning the incoming channel, only valid when using as con_filt! *)
  62.  
  63. Var
  64.   Param          : String;
  65.   P,
  66.   Code           : Integer;
  67.  
  68. Begin
  69.   GetConnectChannel := 0;
  70.   If ParamCount >= 6 then
  71.   Begin
  72.     Param := ParamStr(6);
  73.     Val(Param,P,Code);
  74.     If Code = 0 then GetConnectChannel := P;
  75.   End;
  76. End;
  77.  
  78.  
  79. Procedure DisplayStatus(Full : Boolean);
  80.  
  81. (* Read the data from memory and display on channel *)
  82.  
  83. Var
  84.   LinePart     : String;
  85.   SysopCall    : String[10];
  86.   Channel      : Byte;
  87.  
  88. Begin
  89.   For Channel := 1 to ChannelData[0].MaxChannel do { Scan the channels 1 to max.}
  90.   Begin
  91.     With ChannelData[Channel] do
  92.     Begin
  93.  
  94.       If SuppCall = '' Then SysopCall := TstHostCall else SysopCall := SuppCall;
  95.  
  96.       Case Chstatus of
  97.         1 : Begin
  98.               LinePart := '(Normal)  ---> '+UserCall;
  99.             End;
  100.         2 : Begin
  101.               LinePart := '(Normal)  <--- '+UserCall+' - '+UIThisConnTime;
  102.             End;
  103.         3 : Begin
  104.               LinePart := '(Forward) <--- '+UserCall+' - '+UIThisConnTime;
  105.             End;
  106.         4 : Begin
  107.               LinePart := '(Forward) ---> '+UserCall;
  108.             End;
  109.         5 : Begin
  110.               LinePart := '(Unproto) ---> '+UserCall;
  111.             End;
  112.       End; {Case}
  113.  
  114.       If Chstatus > 0 then
  115.       Begin
  116.         Writeln('Ch. ',Channel:1,' ',ExtraInfo,' ',
  117.                 SysopCall,LinePart);
  118.       End;
  119.  
  120.     End;
  121.   End;
  122.   If Full then
  123.   Begin
  124.     For Channel := 1 to ChannelData[0].MaxChannel do
  125.     Begin
  126.       With ChannelData[Channel] do
  127.       If (Chstatus = 2) or (ChStatus = 3) and (GetConnectChannel = Channel) then
  128.       Begin
  129.         Writeln;
  130.         Writeln('Tsthost version       : ',Version);
  131.         Case DrvType of
  132.           0  : Writeln('Drivertype            : TFPCX, using IRQ vector : ',IntNo);
  133.           1  : Writeln('Drivertype            : Real host driver, comport : ',Port,' baudrate : ',BaudRate);
  134.           2  : Writeln('Drivertype            : DRSI');
  135.         End; { Case }
  136.         Writeln('MaxChannel            : ',MaxChannel);
  137.         If UlistEnable <> 0 then
  138.           Writeln('UlistEnabled          : Active') else
  139.           Writeln('UlistEnabled          : Not active');
  140.         Writeln('WorkDir               : ',WPath);
  141.         Writeln('UploadPath            : ',UPath);
  142.         Writeln('HomeBBS               : ',HomeBBS);
  143.         Writeln('HomeAlias             : ',HomeAlias);
  144.         Writeln('UserName              : ',UIname);
  145.         Writeln('Last time connected   : ',UILastConnTime);
  146.         Writeln('Last time message     : ',UILastMsgList);
  147.         Writeln('Number of connections : ',UINbrConn);
  148.         Writeln('Time connected        : ',UIThisConnTime);
  149.         Writeln('Sys level             : ',SysFlag); { when using as con_filt always 0 !}
  150.         Writeln('Memory available      : ',MemAvail);
  151.       End;
  152.     End;
  153.   End;
  154.   Writeln;
  155. End;
  156.  
  157.  
  158.  
  159.  
  160. Begin { main }
  161.   GetTstHostIRQVector(TstHostIRQVector,TstHostActive);
  162.   If NOT TstHostActive then
  163.   Begin
  164.     Writeln('This programm requires TstHost.');
  165.     Writeln('This software is public domain. It can be installed or copied only for');
  166.     Writeln('amateur radio use. All commercial or professional use is prohibited.');
  167.     Writeln;
  168.     Writeln('Packet address : PE1PKD @ PI8WFL.#NH1.NLD.EU');
  169.     Halt(0);
  170.   End;
  171.   Writeln('CONnect FiLTer V1.2 entry activated.');
  172.   Writeln;
  173. (*  Fillchar(ChannelData,SizeOf(ChannelData),' '); {Clear all data} *)
  174.   GetChannelsInfo(TstHostIRQVector);
  175.   ReadCfgFile(GetTstHostPath + 'CON_FILT.CFG',FullInfo);
  176.   DisplayStatus(FullInfo);
  177. End.
  178.  
  179.  
  180.  
  181.  
  182.